package day04;

import java.util.Scanner;

public class Guessing {
    public static void main(String[] args) {
        int num = (int)(Math.random()*1000+1);
    //    System.out.println("请输入猜测的数");
        Scanner scan=new Scanner(System.in);
        System.out.println(num);
        int guess;
        do{
            System.out.println("请输入");
            guess=scan.nextInt();
            if(guess>num){
                System.out.println("输入的数大了");
            }else if(guess<num){
                System.out.println("输入的数字小了");
            }else {
                System.out.println("输入正确！");
            }
        }while (guess!=num);

























        // 自动生成数： math.rangmo()  [0.001-0.999999]
        /*
        Math.randmo()-------0.0到0.99999999..
        *1000---------------0到999.99999..
        +1------------------1到1000.99999..
        int-----------------1到1000
         */
       /*
       int num = (int)(Math.random()*1000+1);

       // System.out.println(num);
        System.out.println("请输入猜测的数");
        Scanner scan=new Scanner(System.in);
        int guess=scan.nextInt();
        while (guess!=num){
            if(guess>num){
                System.out.println("输入错误，输入数大了");
              //  guess=scan.nextInt();
            }else {
                System.out.println("输入错误，输入数小了");

            }
            guess=scan.nextInt();
        }
        System.out.println("恭喜你输入正确！");
        */

    }
}
